using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TmxLib;
using TmxUtil;

namespace TmxMerge
{
    public partial class ResDiffForm : Form
    {
        private Solution _solution;
        private string _tmxName;
        private IList<string> _log;
        private TmxLanguageCollection _langages;

        public delegate void MergeHandler(Project.ReadonlyPolicy readonlyPolicy);

        public event MergeHandler Merge;

        private ResDiffForm()
        {
            InitializeComponent();
            comboBoxReadOnlyPolicy.SelectedIndex = 0;
        }


        public ResDiffForm(Solution solution, string tmxName, IList<string> log, TmxLanguageCollection langages): this()
        {
            _solution = solution;
            _tmxName = tmxName;
            _log = log;
            _langages = langages;

            Bind();
        }

        void Bind()
        {

            listViewLog.Columns.Clear();
            listViewLog.Columns.Add("Info");
            listViewLog.Columns[0].Width = listViewLog.ClientSize.Width;
            textBoxTmxFile.Text = _tmxName;
            textBoxSolution.Text = _solution.SlnFile;

            foreach (String i in _log)
                listViewLog.Items.Add(i);

            textBoxLanguages.Text = _langages.ToLongString();
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void buttonMerge_Click(object sender, EventArgs e)
        {
            // MessageBox.Show("Not Implemented", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
            if (Merge != null)
                Merge((Project.ReadonlyPolicy) comboBoxReadOnlyPolicy.SelectedIndex);
        }
    }
}